/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kpsmart.gui;

import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultListModel;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import network.IconManager;

/**
 * Central frame of kpsmart client
 *
 * @author Oliver Behncke
 */
public class View extends javax.swing.JFrame {

    private List<String> list = new ArrayList<String>();

    /**
     * Creates new form MainJFrame
     */
    View() {
        setIconImage(IconManager.getWindowIcon());
        initComponents();
    }

    /**
     * Set the event list of manager panel.
     *
     * @param list
     */
    void setEventList(List<String> list) {
        DefaultListModel model = new DefaultListModel();
        this.list = list;
        for (String element : list) {
            model.addElement(element);
        }
        this.jList1.setModel(model);
    }

    /**
     * Add ListSelectionListener to event list in manager panel.
     *
     * @param listener
     */
    void addListenerToEventList(ListSelectionListener listener) {
        this.jList1.addListSelectionListener(listener);
    }

    /**
     * Set event detail text next to event list in manager view
     *
     * @param string
     */
    void setDetailText(String string) {
        this.jTextArea1.setText(string);
        this.repaint();
    }

    /**
     * Get selected index of event list in manager view
     *
     * @return
     */
    int getSelectedIndexEventList() {
        return this.jList1.getSelectedIndex();
    }

    /**
     * Set the text of revenue text field in manager view to int value
     *
     * @param revenue
     */
    void setManagerRevenue(int revenue) {
        this.jTextFieldManagerRevenue.setText(Integer.valueOf(revenue).toString());
    }

    /**
     * Set the text of expenditure text field in manager view to int value
     *
     * @param expenditure
     */
    void setManagerExpenditure(int expenditure) {
        this.jTextFieldManagerExpenditure.setText(Integer.valueOf(expenditure).toString());
    }

    /**
     * Set the text of number of mail items text field in manager view to int
     * value
     *
     * @param mails
     */
    void setManagerMail(int mails) {
        this.jTextFieldManagerMails.setText(Integer.valueOf(mails).toString());
    }

    /**
     * Set the text of volume text field in manager view to int value
     *
     * @param volume
     */
    void setManagerVolume(int volume) {
        this.jTextFieldManagerVolume.setText(Integer.valueOf(volume).toString());
    }

    /**
     * Set the text of weight text field in manager view to int value
     *
     * @param weight
     */
    void setManagerWeight(int weight) {
        this.jTextFieldManagerWeight.setText(Integer.valueOf(weight).toString());
    }

    /**
     * Set the text of number of events text field in manager view to int value
     *
     * @param events
     */
    void setManagerEvents(int events) {
        this.jTextFieldManagerEvents.setText(Integer.valueOf(events).toString());
    }

    /**
     * Set the data of the average delivery times table in manager view.
     *
     * @param data as two dimensional array
     * @param columnNames as one dimensional array
     */
    void setManagerDetailsTable(Object[][] data, Object[] columnNames) {
        this.jTableManagerDetails.setModel(new DefaultTableModel(data, columnNames) {

            @Override
            public boolean isCellEditable(int row, int col) {
                return false;
            }
        });
    }

    /**
     * Set the data of the critical route table in manager view.
     *
     * @param data as two dimensional array
     * @param columnNames as one dimensional array
     */
    void setManagerCriticalRoutesTable(Object[][] data, Object[] columnNames) {
        this.jTableManagerCriticalRoutes.setModel(new DefaultTableModel(data, columnNames) {

            @Override
            public boolean isCellEditable(int row, int col) {
                return false;
            }
        });
    }

    /**
     * Set text of number of events text field in regular as int
     *
     * @param events
     */
    void setRegularEvents(int events) {
        this.jTextFieldRegularEvents.setText(Integer.valueOf(events).toString());
    }

    /**
     * Set text of revenue text field in regular as int
     *
     * @param revenue
     */
    void setRegularRevenue(int revenue) {
        this.jTextFieldRegularRevenue.setText(Integer.valueOf(revenue).toString());
    }

    /**
     * Set text of expenditure text field in regular as int
     *
     * @param expenditure
     */
    void setRegularExpenditure(int expenditure) {
        this.jTextFieldRegularExpenditure.setText(Integer.valueOf(expenditure).toString());
    }

    /**
     * Set text of number of mail items text field in regular view as int
     *
     * @param mails
     */
    void setRegularMail(int mails) {
        this.jTextFieldRegularMails.setText(Integer.valueOf(mails).toString());
    }

    /**
     * Set text of volume text field in regular view as int
     *
     * @param volume
     */
    void setRegularVolume(int volume) {
        this.jTextFieldRegularVolume.setText(Integer.valueOf(volume).toString());
    }

    /**
     * Set text of weight text field in regular view as int
     *
     * @param weight
     */
    void setRegularWeight(int weight) {
        this.jTextFieldRegularWeight.setText(Integer.valueOf(weight).toString());
    }

    /**
     * Set data of average delivery times table of regular view
     *
     * @param data as two dimensional array
     * @param columnNames as one dimensional array
     */
    void setRegularDetailsTable(Object[][] data, Object[] columnNames) {
        this.jTableRegularDetails.setModel(new DefaultTableModel(data, columnNames) {

            @Override
            public boolean isCellEditable(int row, int col) {
                return false;
            }
        });
    }

    /**
     * Set data of critical routes table of regular view
     *
     * @param data as two dimensional array
     * @param columnNames as one dimensional array
     */
    void setRegularCriticalRoutesTable(Object[][] data, Object[] columnNames) {
        this.jTableRegularCriticalRoutes.setModel(new DefaultTableModel(data, columnNames) {

            @Override
            public boolean isCellEditable(int row, int col) {
                return false;
            }
        });
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPaneMain = new javax.swing.JTabbedPane();
        jPanelRegular = new javax.swing.JPanel();
        jButtonCostUpdate = new javax.swing.JButton();
        jButtonDiscontinueUpdate = new javax.swing.JButton();
        jButtonNewMail = new javax.swing.JButton();
        jButtonPriceUpdate = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jTextFieldRegularRevenue = new javax.swing.JTextField();
        jTextFieldRegularExpenditure = new javax.swing.JTextField();
        jTextFieldRegularEvents = new javax.swing.JTextField();
        jTextFieldRegularVolume = new javax.swing.JTextField();
        jTextFieldRegularMails = new javax.swing.JTextField();
        jTextFieldRegularWeight = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jLabel18 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        jTableRegularCriticalRoutes = new javax.swing.JTable();
        jLabel19 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        jTableRegularDetails = new javax.swing.JTable();
        jButtonEdit = new javax.swing.JButton();
        jButtonReconnect = new javax.swing.JButton();
        jPanelManager = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jTextFieldManagerRevenue = new javax.swing.JTextField();
        jTextFieldManagerExpenditure = new javax.swing.JTextField();
        jTextFieldManagerEvents = new javax.swing.JTextField();
        jTextFieldManagerVolume = new javax.swing.JTextField();
        jTextFieldManagerMails = new javax.swing.JTextField();
        jTextFieldManagerWeight = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        jPanel2 = new javax.swing.JPanel();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTableManagerCriticalRoutes = new javax.swing.JTable();
        jLabel10 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTableManagerDetails = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("KPSmart Client");

        jButtonCostUpdate.setText("New Transport Route");

        jButtonDiscontinueUpdate.setText("Discontinue Transport Route");

        jButtonNewMail.setText("New Mail");

        jButtonPriceUpdate.setText("Price Update");

        jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/kpsmart/gui/resources/KPS.png"))); // NOI18N

        jLabel12.setText("Total Revenue:");

        jTextFieldRegularRevenue.setEditable(false);
        jTextFieldRegularRevenue.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jTextFieldRegularExpenditure.setEditable(false);
        jTextFieldRegularExpenditure.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jTextFieldRegularEvents.setEditable(false);
        jTextFieldRegularEvents.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jTextFieldRegularVolume.setEditable(false);
        jTextFieldRegularVolume.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jTextFieldRegularMails.setEditable(false);
        jTextFieldRegularMails.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jTextFieldRegularWeight.setEditable(false);
        jTextFieldRegularWeight.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jLabel13.setText("Total Expenditure:");

        jLabel14.setText("Total Mail Volume:");

        jLabel15.setText("Total Mail Weight:");

        jLabel16.setText("Total Number of Events:");

        jLabel17.setText("Total Number of Mail Items:");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 295, Short.MAX_VALUE)
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel12)
                        .addComponent(jLabel13)
                        .addComponent(jLabel16)
                        .addComponent(jLabel14)
                        .addComponent(jLabel15)
                        .addComponent(jLabel17))
                    .addGap(18, 18, 18)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGap(1, 1, 1)
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jTextFieldRegularRevenue)
                                    .addComponent(jTextFieldRegularExpenditure, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jTextFieldRegularEvents)
                            .addComponent(jTextFieldRegularVolume)
                            .addComponent(jTextFieldRegularWeight, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jTextFieldRegularMails, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(16, Short.MAX_VALUE)))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 380, Short.MAX_VALUE)
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel12)
                        .addComponent(jTextFieldRegularRevenue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel13)
                        .addComponent(jTextFieldRegularExpenditure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(3, 3, 3)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel16)
                        .addComponent(jTextFieldRegularEvents, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel14)
                        .addComponent(jTextFieldRegularVolume, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel15)
                        .addComponent(jTextFieldRegularWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel17)
                        .addComponent(jTextFieldRegularMails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(227, Short.MAX_VALUE)))
        );

        jPanel5.setPreferredSize(new java.awt.Dimension(869, 400));

        jLabel18.setText("Average delivery time");

        jTableRegularCriticalRoutes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jScrollPane5.setViewportView(jTableRegularCriticalRoutes);

        jLabel19.setText("Critical Routes");

        jTableRegularDetails.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jScrollPane6.setViewportView(jTableRegularDetails);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel19)
                    .addComponent(jLabel18))
                .addContainerGap(722, Short.MAX_VALUE))
            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 845, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 845, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel18)
                .addGap(131, 131, 131)
                .addComponent(jLabel19)
                .addContainerGap(227, Short.MAX_VALUE))
            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addGap(38, 38, 38)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(249, Short.MAX_VALUE)))
            .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addGap(183, 183, 183)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(76, Short.MAX_VALUE)))
        );

        jButtonEdit.setText("Edit Transport Route");

        jButtonReconnect.setText("Reconnect");

        javax.swing.GroupLayout jPanelRegularLayout = new javax.swing.GroupLayout(jPanelRegular);
        jPanelRegular.setLayout(jPanelRegularLayout);
        jPanelRegularLayout.setHorizontalGroup(
            jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelRegularLayout.createSequentialGroup()
                .addGap(92, 92, 92)
                .addGroup(jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButtonCostUpdate, javax.swing.GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE)
                    .addComponent(jButtonDiscontinueUpdate, javax.swing.GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE)
                    .addComponent(jButtonEdit, javax.swing.GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButtonPriceUpdate, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE)
                    .addComponent(jButtonNewMail, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE))
                .addGap(459, 459, 459)
                .addGroup(jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jButtonReconnect, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanelRegularLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()))
        );
        jPanelRegularLayout.setVerticalGroup(
            jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelRegularLayout.createSequentialGroup()
                .addGroup(jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelRegularLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButtonCostUpdate)
                            .addComponent(jButtonNewMail))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButtonPriceUpdate)
                            .addComponent(jButtonDiscontinueUpdate))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonEdit))
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonReconnect)
                .addContainerGap(553, Short.MAX_VALUE))
            .addGroup(jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanelRegularLayout.createSequentialGroup()
                    .addGap(150, 150, 150)
                    .addGroup(jPanelRegularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(167, Short.MAX_VALUE)))
        );

        jTabbedPaneMain.addTab("Regular", jPanelRegular);

        jPanelManager.setPreferredSize(new java.awt.Dimension(1146, 849));

        jLabel3.setText("Total Revenue:");

        jTextFieldManagerRevenue.setEditable(false);
        jTextFieldManagerRevenue.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jTextFieldManagerExpenditure.setEditable(false);
        jTextFieldManagerExpenditure.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jTextFieldManagerEvents.setEditable(false);
        jTextFieldManagerEvents.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jTextFieldManagerVolume.setEditable(false);
        jTextFieldManagerVolume.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jTextFieldManagerMails.setEditable(false);
        jTextFieldManagerMails.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jTextFieldManagerWeight.setEditable(false);
        jTextFieldManagerWeight.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        jLabel4.setText("Total Expenditure:");

        jLabel5.setText("Total Mail Volume:");

        jLabel6.setText("Total Mail Weight:");

        jLabel7.setText("Total Number of Events:");

        jLabel8.setText("Total Number of Mail Items:");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 295, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel3)
                        .addComponent(jLabel4)
                        .addComponent(jLabel7)
                        .addComponent(jLabel5)
                        .addComponent(jLabel6)
                        .addComponent(jLabel8))
                    .addGap(18, 18, 18)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(1, 1, 1)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jTextFieldManagerRevenue)
                                    .addComponent(jTextFieldManagerExpenditure, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jTextFieldManagerEvents)
                            .addComponent(jTextFieldManagerVolume)
                            .addComponent(jTextFieldManagerWeight, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jTextFieldManagerMails, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(16, Short.MAX_VALUE)))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jTextFieldManagerEvents, jTextFieldManagerExpenditure, jTextFieldManagerMails, jTextFieldManagerRevenue, jTextFieldManagerVolume, jTextFieldManagerWeight});

        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 380, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel3)
                        .addComponent(jTextFieldManagerRevenue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel4)
                        .addComponent(jTextFieldManagerExpenditure, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(3, 3, 3)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel7)
                        .addComponent(jTextFieldManagerEvents, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5)
                        .addComponent(jTextFieldManagerVolume, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel6)
                        .addComponent(jTextFieldManagerWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel8)
                        .addComponent(jTextFieldManagerMails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(227, Short.MAX_VALUE)))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jTextFieldManagerEvents, jTextFieldManagerExpenditure, jTextFieldManagerMails, jTextFieldManagerRevenue, jTextFieldManagerVolume, jTextFieldManagerWeight});

        jLabel1.setText("Events");

        jTextArea1.setColumns(20);
        jTextArea1.setEditable(false);
        jTextArea1.setRows(5);
        jScrollPane2.setViewportView(jTextArea1);

        jLabel2.setText("Event Details:");

        jList1.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "No event" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(jList1);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 472, Short.MAX_VALUE))
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 734, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel1)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 418, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE))
                .addContainerGap())
        );

        jPanel2.setPreferredSize(new java.awt.Dimension(869, 400));

        jLabel9.setText("Average delivery time");

        jTableManagerCriticalRoutes.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jScrollPane4.setViewportView(jTableManagerCriticalRoutes);

        jLabel10.setText("Critical Routes");

        jTableManagerDetails.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {

            }
        ));
        jScrollPane3.setViewportView(jTableManagerDetails);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel10)
                    .addComponent(jLabel9))
                .addContainerGap(722, Short.MAX_VALUE))
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 845, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 845, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel9)
                .addGap(131, 131, 131)
                .addComponent(jLabel10)
                .addContainerGap(227, Short.MAX_VALUE))
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGap(38, 38, 38)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(249, Short.MAX_VALUE)))
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGap(183, 183, 183)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(76, Short.MAX_VALUE)))
        );

        javax.swing.GroupLayout jPanelManagerLayout = new javax.swing.GroupLayout(jPanelManager);
        jPanelManager.setLayout(jPanelManagerLayout);
        jPanelManagerLayout.setHorizontalGroup(
            jPanelManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelManagerLayout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanelManagerLayout.setVerticalGroup(
            jPanelManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelManagerLayout.createSequentialGroup()
                .addGroup(jPanelManagerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jTabbedPaneMain.addTab("Manager", jPanelManager);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPaneMain, javax.swing.GroupLayout.DEFAULT_SIZE, 1199, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPaneMain, javax.swing.GroupLayout.DEFAULT_SIZE, 744, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonCostUpdate;
    private javax.swing.JButton jButtonDiscontinueUpdate;
    private javax.swing.JButton jButtonEdit;
    private javax.swing.JButton jButtonNewMail;
    private javax.swing.JButton jButtonPriceUpdate;
    private javax.swing.JButton jButtonReconnect;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JList jList1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanelManager;
    private javax.swing.JPanel jPanelRegular;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JTabbedPane jTabbedPaneMain;
    private javax.swing.JTable jTableManagerCriticalRoutes;
    private javax.swing.JTable jTableManagerDetails;
    private javax.swing.JTable jTableRegularCriticalRoutes;
    private javax.swing.JTable jTableRegularDetails;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextFieldManagerEvents;
    private javax.swing.JTextField jTextFieldManagerExpenditure;
    private javax.swing.JTextField jTextFieldManagerMails;
    private javax.swing.JTextField jTextFieldManagerRevenue;
    private javax.swing.JTextField jTextFieldManagerVolume;
    private javax.swing.JTextField jTextFieldManagerWeight;
    private javax.swing.JTextField jTextFieldRegularEvents;
    private javax.swing.JTextField jTextFieldRegularExpenditure;
    private javax.swing.JTextField jTextFieldRegularMails;
    private javax.swing.JTextField jTextFieldRegularRevenue;
    private javax.swing.JTextField jTextFieldRegularVolume;
    private javax.swing.JTextField jTextFieldRegularWeight;
    // End of variables declaration//GEN-END:variables

    /**
     * Add actionlistener to cost update button
     *
     * @param actionListener
     */
    void addListenerToCostUpdate(ActionListener actionListener) {
        this.jButtonCostUpdate.addActionListener(actionListener);
    }

    /**
     * Add actionlistener to discontinue update button
     *
     * @param actionListener
     */
    void addListenerToDiscontinueUpdate(ActionListener actionListener) {
        this.jButtonDiscontinueUpdate.addActionListener(actionListener);
    }

    /**
     * Add actionlistener to edit button
     *
     * @param actionListener
     */
    void addListenerToEdit(ActionListener actionListener) {
        this.jButtonEdit.addActionListener(actionListener);
    }

    /**
     * Add actionlistener to new mail button
     *
     * @param actionListener
     */
    void addListenerToNewMail(ActionListener actionListener) {
        this.jButtonNewMail.addActionListener(actionListener);
    }

    /**
     * Add actionlistener to price update
     *
     * @param actionListener
     */
    void addListenerToPriceUpdate(ActionListener actionListener) {
        this.jButtonPriceUpdate.addActionListener(actionListener);
    }

    void addListenerToReconnect(ActionListener actionListener){
        this.jButtonReconnect.addActionListener(actionListener);
    }
}
